package com.lanhe.app.controller.qingchuang;

import com.lanhe.common.core.controller.BaseController;
import com.lanhe.common.core.domain.AjaxResult;
import com.lanhe.common.core.page.TableDataInfo;
import com.lanhe.product.domain.LhQingchuangProduct;
import com.lanhe.product.service.ILhQingchuangProductDetailsService;
import com.lanhe.product.service.ILhQingchuangProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 轻创优选
 *
 * @author zhanggl
 * @date 2023年12月11日23:11:30
 */
@RestController
@RequestMapping("/api/qingchuang")
public class ApiQingChuangController extends BaseController {

	@Autowired
	private ILhQingchuangProductService productService;


	@Autowired
	private ILhQingchuangProductDetailsService productDetailsService;


	/**
	 * 分页查询所有数据
	 *
	 * @author zhanggl
	 * @date 2023年12月04日20:25:24
	 */
	@GetMapping("/list")
	public TableDataInfo list(LhQingchuangProduct product) {
		startPage();
		List<LhQingchuangProduct> list = productService.selectProductList(product);
		return getDataTable(list);
	}

	/**
	 * 根据编号获取详细信息
	 */
	@GetMapping(value = {"/", "/{number}"})
	public AjaxResult detail(@PathVariable(value = "number") String number) {
		return success(productDetailsService.selectProductDetailByNumber(number));
	}

}

